package acs.bridge.dao;

import acs.bridge.model.RawTableMail;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * acs.dao
 * User: KuznetsovStV
 * Date: 07.04.13
 * Time: 16:01
 */
public class RawTableMailDAOImpl implements RawTableMailDAOInterface {
    private String tableName;

    public JdbcTemplate getJdbcTemplate() {
        return jdbcTemplate;
    }



    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    private JdbcTemplate jdbcTemplate;


    public void Insert(RawTableMail a_RawTableMail) {
        jdbcTemplate.update("INSERT INTO " + getTableName()  + " (SEND_ADR,RECIP_ADR, COPY_ADR, MAIL_SUBJECT, SMTP_HOST, SMTP_USER,\n" +
                "SMTP_PASS, ATTACH_DATA, ATTACH_TYPE, ATTACH_NAME, ARCH_ENABLE,\n" +
                "ARCH_NAME, BCOPY_ADR, MAIL_BODY) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
               new Object[] { a_RawTableMail.getSend_adr(), a_RawTableMail.getRecip_adr(), a_RawTableMail.getCopy_adr(), a_RawTableMail.getMail_subject(), a_RawTableMail.getSmtp_host(), a_RawTableMail.getSmtp_user(),
               a_RawTableMail.getSmtp_pass(), a_RawTableMail.getAttach_data(), a_RawTableMail.getAttach_type(), a_RawTableMail.getAttach_name(), a_RawTableMail.getArch_enable(),
               a_RawTableMail.getArch_name(), a_RawTableMail.getBcopy_adr(), a_RawTableMail.getMail_body() });
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }
}
